-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[hal] Support user space for riscv64 and aarch64 #179
base: monolithic
Are you sure you want to change the base?
Conversation
@@ -15,6 +15,145 @@ pub struct TrapFrame { | |||
pub spsr: u64, | |||
} | |||
|
|||
impl TrapFrame { | |||
/// Gets the 0th syscall argument. | |||
pub const fn arg0(&self) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use pub const fn arg(&self, index: usize) -> usize
?
impl UspaceContext { | ||
/// Creates an empty context with all registers set to zero. | ||
pub const fn empty() -> Self { | ||
unsafe { core::mem::MaybeUninit::zeroed().assume_init() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Default::default()
?
|
||
/// Context to enter user space. | ||
#[cfg(feature = "uspace")] | ||
pub struct UspaceContext(TrapFrame); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think UserSpaceContext
is a better name.
} | ||
|
||
/// Sets the instruction pointer. | ||
pub const fn set_ip(&mut self, pc: usize) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ip
or pc
?
@@ -53,6 +53,136 @@ pub struct TrapFrame { | |||
pub sstatus: usize, | |||
} | |||
|
|||
impl TrapFrame { | |||
/// Gets the 0th syscall argument. | |||
pub const fn arg0(&self) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as aarch64.
No description provided.